<extend name="Public:listbase"/>
<block name="content">
    <h3>|&nbsp;&nbsp;&nbsp;{$sidef.name}</h3>
    <div class="news">
        <form action="{:U('Home/Page/msgsubmit')}" method="post" name="myform" id="myform" class = "myform">
            <table cellspacing="1" cellpadding="0" class="table_form">
                <tbody>

                <tr>
                    <th>姓名</th>
                    <td><input type="text" value="" id="name" name="name" class="input-text" placeholder="请输入您的姓名"></td>
                </tr>

                <tr>
                    <th>手机</th>
                    <td>
                        <input type="text" size="40" value="" name="phone" id="phone" class="input-text" placeholder="请输入您的联系手机">(选填)
                    </td>
                </tr>
                <tr>
                    <th>标题</th>
                    <td><input type="text" value="" id="title" name="title" class="input-text" placeholder="请输入标题"></td>
                </tr>
                <tr>
                    <th>留言内容</th>
                    <td><textarea name="content" cols="40" rows="5" class="input-text" id="content" placeholder="在此输入您的留言.."></textarea></td>
                </tr>


                <tr>
                    <th>验证码：</th>
                    <td>
                        <input name="verifycode" type="text" id="code" size="9"  class="input-text" placeholder="请输入验证码"/>
                    </td>
                </tr>
                <tr>
                    <th></th>
                    <td>
                        <img id="verifycode" alt="点击换一张" src="{:U('Home/Index/verify_c')}">
                    </td>
                </tr>

                <tr>
                    <th></th>
                    <td>
                        <input type="submit" value=" 提 交 " class="button orange">
                        <input type="reset" value=" 取 消 " class="button orange"> </td>
                </tr>
                </tbody>
            </table>
            <script type="text/javascript" src="__PUBLIC__//Js/jquery.js"></script>

            <script>
                $(document).ready(function () {
                    $("#verifycode").click(function () {
                        var time = new Date().getTime();
                        var imgurl = $(this).attr('src');
                        $(this).attr('src', imgurl + "?" + time);
                    });
                });


                $("form").submit(function () {
                    if ($("input[name='name']").val().length == 0) {
                        alert("请输入姓名！");
                        $("input[name='name']").focus();
                        return false;
                    }
                    if ($("input[name='title']").val().length == 0) {
                        alert("请输入标题！");
                        $("input[name='title']").focus();
                        return false;
                    }
                    if ($("#content").val().length == 0) {
                        alert("请输入留言内容！");
                        $("#content").focus();
                        return false;
                    }
                    var verifycode = $("input[name='verifycode']").val();
                    var vs = false;
                    $.ajax({
                        data: {verify: verifycode},
                        type: "post",
                        url: "{:U('Home/Index/verify_check')}",
                        async: false,
                        success: function (result) {
                            if (result == "false") {
                                alert("验证码错误！");
                            } else {
                                vs = true;
                            }
                        }
                    });

                    if (!vs) return false;


                });
            </script>
        </form>
        <!--right_bar-->
    </div>
</block>

<block name="left">
    <div class="con_left_top">{$current.name}</div>
    <div class="con_left_list">
        <ul>
            <if condition="empty($sidec)">
                <li><a href="">
                    {$sidef.name}
                </a></li>
            </if>
            <volist name="sidec" id="vo">
                <li>
                    <if condition="$vo['typeid'] eq 2">
                        <a href="{$vo.href}">{$vo.name}</a>
                        <else />
                        <a href="{:U($vo['href'])}">{$vo.name}</a>
                    </if>
                </li>
            </volist>
        </ul>
    </div>
</block>
